package cn.wolfcode.trip.core.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

/**
 * 大攻略
 */
@Setter
@Getter
public class Strategy extends BaseDomain{

    public final static int STATE_COMMON = 0;//普通
    public final static int STATE_HOT = 1;//热门
    public final static int STATE_DISABLE = -1;//禁用

    //所属地区
    private Region place;
    //标题
    private String title;
    //副标题
    private String subTitle;
    //封面
    private String coverUrl;
    //状态
    private Integer state = STATE_COMMON;

    public String getStateName(){
        String temp = "普通";
        if(STATE_HOT==state){
            temp = "热门";
        }else if(STATE_DISABLE==state){
            temp = "禁用";
        }
        return temp;
    }

    public String getJson(){

        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        if(place!=null){
            map.put("placeId",place.getId());
            map.put("placeName",place.getName());
        }
        return JSON.toJSONString(map);
    }


}